package com.zc.ex.userProvider.common;

/**
 * 接口返回封装类
 * @param <T>
 */
public final class BaseResult<T> {

    /**
     * 是否成功
     */
    private Boolean success;

    /**
     * 内容
     */
    private T content;

    /**
     * 发生错误时的错误信息
     */
    private String message;

    /**
     * 额外的字段
     */
    private String code;


    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public T getContent() {
        return content;
    }

    public void setContent(T content) {
        this.content = content;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void successContent(T content){
        this.success = true;
        this.content = content;
    }

    public void failureContent(Exception e){
        this.success = false;
        this.message = e.getMessage();
    }

    public void failureContent(String message){
        this.success = false;
        this.message = message;
    }
}
